<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    //创建一个空Map
    let m = new Map();
    //创建一个非空Map
    let m2 = new Map([
        ['name','林晓'],
        ['age','21']
    ]);
    //添加元素
    m2.set('salary','30000');
    //添加方法
    m2.set('fighting', function(){
        console.log("加油!!");
    });
    console.log(m2);

    // 获取
    console.log(m2.get('name'));
    console.log(m2.get('age'));
    console.log(m2.get('salary'));
    console.log(m2.get('fighting'));

    // 删除
    m2.delete('age');

    // 检查是否包含某元素
    console.log(m2.has('age'));

    // 清除
    m2.clear();
</script>
</html>